package com.suixin.repository;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import com.suixin.entity.Position;

/**
 * @author wujunhong
 */
public interface PositionRepository extends JpaRepository<Position,Long> {

    /**
     * 根据id查询职位及详情信息
     * @param id 职位主键id
     * @return 职位及详情信息
     */
    @Query(nativeQuery=true,value="select p.id,p.name,p.salary,p.city,pd.description from position p join position_detail pd on p.id=pd.pid where p.id=:id")
    Object findPositionById(@Param("id") Long id);
}
